import request from '@/utils/request'

export const save = data => {
  return request({
    url: '/SeriesRAPI/WareHouse/Add',
    method: 'post',
    data
  })
}

export const getList = params => {
  return request({
    url: '/SeriesRAPI/WareHouse/GetList',
    method: 'get',
    params: params
  })
}

export const getLocationList = (id, params) => {
  return request({
    url: `/SeriesRAPI/WareHouse/LocationList/${id}`,
    method: 'get',
    params: params
  })
}

export const getWareHouseLocationById = id => {
  return request({
    url: `/SeriesRAPI/WareHouse/Location/${id}`,
    method: 'get',
  })
}

export const getWareHouseById = id => {
  return request({
    url: `/SeriesRAPI/WareHouse/${id}`,
    method: 'get',
  })
}

export const saveLocation = data => {
  return request({
    url: '/SeriesRAPI/WareHouse/AddLocation',
    method: 'post',
    data
  })
}

export const remove = data => {
  return request({
    url: `/SeriesRAPI/WareHouse/Remove`,
    method: 'post',
    data
  })
}

export const getWareHouseListByEnterpriseId = (id, params) => {
  return request({
    url: `/SeriesRAPI/WareHouse/GetListByEnterpriseId/${id}`,
    method: 'get',
    params: params
  })
}

// 得到出入库记录List
export const getInOutStoreRecordList = params => {
  return request({
    url: '/SeriesRAPI/HazardousWaste/GetHazardousWasteInoutrecordList',
    method: 'get',
    params: params
  })
}
// 新建入库 自产废物入库
export const addInStoreOfSecondWast = data => {
  return request({
    url: '/SeriesRAPI/HazardousWaste/SelfProductionHazardousWasteWarehousing',
    method: 'post',
    data
  })
}

// 新建入库 转运废物入库
export const addInStoreOfCollectedWast = data => {
  return request({
    url: '/SeriesRAPI/HazardousWaste/TransportProHWwarehousing',
    method: 'post',
    data
  })
}

// 得到当前用户组织下的全部仓库
export function getWareHouseList() {
  return request({
    url: '/SeriesRAPI/WareHouse/GetAllWareHosueList',
    method: 'get',

  })
}

// 得到指定ID的仓库的库位List
export const getPosListByWareHouseId = id => {
  return request({
    url: `/SeriesRAPI/WareHouse/GetAllWareHosueLocationList?id=${id}`,
    method: 'get',
  })
}

// 新建出库
export const SelfProductionHazardousWasteExWarehouse = data => {
  return request({
    url: '/SeriesRAPI/HazardousWaste/SelfProductionHazardousWasteExWarehouse',
    method: 'post',
    data
  })
}

// 根据废物代码汇总过滤，得到统一废物代码List
export const getWastCodeList = params => {
  return request({
    url: '/SeriesRAPI/HazardousWaste/GetHazardousWasteCodeList',
    method: 'get',
    params: params
  })
}
// 根据废物代码汇总过滤，得到统一废物代码List
export const getWastCodeList_New = params => {
  return request({
    url: '/SeriesRAPI/Master/GetAllCompanyDropdownLists',
    method: 'get',
    params: params
  })
}

// 根据废物代码，获取同一个废物代码下所有废物实体List
export const getWastObjListByCode = params => {
  return request({
    url: '/SeriesRAPI/HazardousWaste/GetHazardousWasteLibraryList',
    method: 'get',
    params: params
  })
}

// 根据废物实体ID查看废物实体详情
export const getWastObjInfoById = id => {
  return request({
    url: `/SeriesRAPI/HazardousWaste/GetHazardousWasteLibrarys?id=${id}`,
    method: 'get',
  })
}
// 获取 出库记录List（分页）
// 过滤：登录用户组织；
// 查询条件：至少包含：转运申请ID、转运申请包含的废物库ID,没有组织过滤

export const GetHazardousWasteInoutrecordListTwo = params => {
  return request({
    url: '/SeriesRAPI/HazardousWaste/GetHazardousWasteInoutrecordListTwo',
    method: 'get',
    params: params
  })
}

// 根据转移申请ID查看其包含的废物实体List（分页）
export const GetTransferApplyByHwLibList = params => {
  return request({
    url: '/SeriesRAPI/HazardousWaste/GetTransferApplyByHwLibList',
    method: 'get',
    params: params
  })
}

// 新建出库，生成废物联单
export const CreateHWReceipt = data => {
  return request({
    url: '/SeriesRAPI/HazardousWaste/CreateHWReceipt',
    method: 'post',
    data
  })
}
